< previous page page_511 next page >

Page 511
(table continued from previous page)
CREATE INDEX StatementMeaning and Use
CREATE INDEX NewIndex ON NewTable (Field1) WITH DISALLOW NULLCreates an index that is not unique, but does not allow null columns.
CREATE INDEX NewIndex ON NewTable (Field1) WITH IGNORE NULL Creates a non-unique index that allows null records in the index column.

Use SQL-VB5 to create a new SQL script that contains the code from Listing 13.7. After you enter the code, save the script as SQLVB03.SQV.
Type.gifListing 13.7. Testing the relationship SQL keywords.
//
// sqlvb03.sqv - Test Relationship SQL keywords
//
// create a database
dbMake sqlvb03.mdb;
// create a test table to work with
CREATE TABLE NewTable1
   (EmployeeID   TEXT(10),
    LastName     TEXT(30),
    FirstName    TEXT(30),
    LoginName    TEXT(15),
    JobTitle     TEXT(20),
    Department   TEXT(10));
// create primary key
CREATE INDEX PKEmployeeID
   ON NewTable1(EmployeeID) WITH PRIMARY;
// create unique key column
CREATE UNIQUE INDEX UKLoginName
   ON NewTable1(LoginName) WITH IGNORE NULL;
// create non-null column
CREATE INDEX IKJobTitle
   ON NewTable1(JobTitle) WITH DISALLOW NULL;
// create multi-column sort key
CREATE INDEX SKDeptSort
   ON NewTable1(Department,LastName,FirstName);
// show empty table
SELECT * FROM NewTable1;
// eof
The preceding SQL script shows several examples of the CREATE INDEX statement. You can use SQL-VB5 to run this script. Your screen should look similar to the one in Figure 13.11.

 
< previous page page_511 next page >

If you like this book, buy it!